// ---------------------------------------------------------------------
//
// -- 积分显示
// -- author £
//
// ---------------------------------------------------------------------

const FADE_TIME = 0.3,
    END_SCALE = 1.4;

cc.Class({
    extends: cc.Component,

    properties: {
        numScore: require('BaseNum'),
        numAn: require('BaseNum'),
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        this.node.active = false;
    },

    start () {
    },

    show: function () {
        this.numAn.node.stopAllActions();
        this.node.active = true;
        this.numAn.node.active = false;
    },

    hide: function () {
        this.node.active = false;
        this.numAn.node.active = false;
    },

    updateScore: function (score) {
        this.numAn.node.active = true;
        this.numScore.updateNum(score);
        this.numAn.clear();

        if (!score) return;

        this.numAn.updateNum(score);
        this.numAn.node.opacity = 255;
        require('ActionLib').FADE_SCALE_HIDE(
            this.numAn.node,
            FADE_TIME, 
            END_SCALE, END_SCALE, 1, 1
        );
    },

    // update (dt) {},
});
